﻿namespace PortableRiotGames.Infrastructure
{
    using Newtonsoft.Json;
    using PortableRiotGames.Infrastructure.Converters;
    using System;
    using System.Collections.Generic;

    /// <summary>
    /// Base class for steam responses.
    /// </summary>
    public class ResponseBase
    {
        /// <summary>
        /// Response status.
        /// </summary>
        public HttpStatus HttpStatus { get; set; }
        /// <summary>
        /// Response error.
        /// </summary>
        public string ErrorMessage { get; set; }
        /// <summary>
        /// True if the query was successful, false otherwise.
        /// </summary>
        [JsonProperty("region")]
        [JsonConverter(typeof(JsonEnumStringConverter<Region>))]
        public Region Region { get; set; }

        /// <summary>
        /// Request URI of this response.
        /// </summary>
        public Uri RequestURI { get; set; }
    }

    /// <summary>
    /// Object that captures responses from different regions.
    /// </summary>
    public class RiotGamesAggregateResponse<T> where T : ResponseBase
    {
        public RiotGamesAggregateResponse()
        {
            this.Responses = new List<T>();
        }
        public List<T> Responses { get; set; }
    }
}